const Koa = require('koa');
const router = require('koa-router')();
const views = require('koa-views');
const path = require('path');
const app = new Koa();
app.use(views(path.resolve(__dirname, 'views'), {extension: 'ejs'}));
const home_api = require('./router/home_api');
// 路由模块化开发
// home模块
router.use('/', home_api);
// user模块

// 先启动路由，然后接受各种方式。这个是链式写法
app.use(router.routes()).use(router.allowedMethods());

app.listen('8081', () => {
  console.log('ok');
})